package com.hmall.api.client;

import com.hmall.api.config.DefaultFeignConfig;
import com.hmall.api.dto.ItemDTO;

import com.hmall.api.dto.OrderDetailDTO;
import com.hmall.api.fallback.ItemClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

//指定微服务名称需要调用的，获取服务是实例的名称
@FeignClient(value = "item-service",fallbackFactory = ItemClientFallback.class)

public interface ItemClient {

//    根据商品id集合查询商品信息
    @GetMapping("/items")
    //public List<ItemDTO> queryItemsByIds(@RequestParam("ids") Collection<Long> ids);

    public List<ItemDTO>queryItemByIds(@RequestParam("ids")Collection<Long>ids);

//   public List<OrderDetailDTO>deductStock(@RequestParam("itemIds") List<OrderDetailDTO> itemIds);
@PutMapping("/items/stock/deduct")
void deductStock(@RequestBody List<OrderDetailDTO> items);
}
